#include<iostream>
#include<string>
using namespace std;
const int N = 210;
char s[N][N];
char t[N][N];
int n, m;
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cout << s[i][j] << s[i][j];
		}
		cout << endl;
		for (int j = 0; j < m; j++) {
			cout << s[i][j] << s[i][j];
		}
		cout << endl;
	}
	/*for (int i = 1; i <= n; i++) {
		cin >> (s[i] + 1);
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			t[i * 2][j * 2] = s[i][j];
		}
	}
	for (int i = 1; i <= 2 * n; i++) {
		for (int j = 1; j <= 2 * m; j++) {
			if (t[i][j] != ' ') {
				s[i][j] = t[i][j];
			}
		}
	}
	for (int i = 1; i <= 2 * n; i++) {
		for (int j = 1; j <= 2 * m; j++) {
			cout << s[i][j];
		}
		cout << endl;
	}*/
	return 0;
}